package com.fitns.user.aop;


import com.fitns.user.aop.annations.ZhhwAnnotation;
import com.fitns.user.service.user.PrivilegeService;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import static com.fitns.user.aop.annations.ZhhwAnnotation.Type.INIT_URL_CODE_ROLE_ID_MAPPING;

@Aspect
@Component
public class RoleUrlAspect {

    @Autowired
    private PrivilegeService privilegeService;

    @AfterReturning(pointcut = "@annotation(zhhwAnnotation)")
    public void getAnnotation(ZhhwAnnotation zhhwAnnotation) {
        // log.debug(result.toString());
        if (INIT_URL_CODE_ROLE_ID_MAPPING == zhhwAnnotation.type()) {
            privilegeService.initUrlCodeRoleIdMapping();
        }
    }
}
